/**
 * 统计图表
 * */


//列表
function getList(){
    var uinfo = getUserInfo();
    var formData = {
        uid: uinfo.uid, 
    };
    $.ajax({
        type: apiMethod,
        url: apiDomain + 'tongji/all',
        data: formData,
        success: function (res) {
            console.log(res);
            if (res.code != 0) {
                msgPop({msg: res.msg});
                return
            }
            getHtml(res.data);
        },
        error: function () {
            console.log('网络错误');
        }
    });
}
function getHtml(d){
    var h = '', i;
    h = '';
    for (i = 0; i < d.length; i ++) {
        h += '<table cellspacing="0">';
        h += '<tr>';
        h += '<td class="tdl">项目</td>';
        h += '<td>';
        h += d[i].item_name;
        h += '</td>';
        h += '</tr>';
        h += '<tr>';
        h += '<td class="tdl">工时</td>';
        h += '<td>';
        var whList = d[i].whList;
        for (var ii = 0; ii < whList.length; ii ++) {
            h += '<div>';
            h += whList[ii].wh_name;
            h += '，' + whList[ii].delay_str;
            h += '</div>';
        }
        h += '</td>';
        h += '</tr>';
        h += '<tr>';
        h += '<td class="tdl">合计时长</td>';
        h += '<td>';
        h += d[i].delay_str;
        h += '</td>';
        h += '</tr>';
        h += '</table>';
    }
    $('.tlist').html(h);
}